﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CKFinder;

public partial class Admin_AddHDSD : System.Web.UI.Page
{
    HDSudungController hdSudungController = new HDSudungController();
    protected void Page_Load(object sender, EventArgs e)
    {

        CKFinder.FileBrowser fb = new FileBrowser();
        fb.BasePath = "../ckfinder/";
        fb.SetupCKEditor(ckeditor_faq);
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        HDSudung hd = new HDSudung();
        hd.Title = txtTitle.Text;
        hd.Content = ckeditor_faq.Text;
        hd.DateStart = DateTime.Now;
        hd.Url = txtUrl.Text;
        if (ddlStatus.SelectedIndex == 0)
        {
            hd.Status = true;
        }
        else
        {
            hd.Status = false;
        }
        if (hdSudungController.Insert(hd) > 0)
        {
            Response.Write("<script>alert('Thêm mới hướng dẫn sử dụng thành công.')</script>");
            Server.Transfer("AddHDSD.aspx");
        }
        else
        {
            Response.Write("<script>alert('Thêm mới hướng dẫn sử dụng gặp lỗi.')</script>");
            return;
        }
    }
}